\" Manpage for immortal.
.\" To correct errors or typos please use https://github.com/immortal/immortal/issues
.TH man 8 "March 2017" "immortaldir" "immortaldir man page"
.SH NAME
immortaldir \- start services located in a specified directory.
.SH SYNOPSIS
immortalctl [dir] [-v]
.SH DESCRIPTION
immortaldir will scan every 5 seconds a directory searching for files ending in .yml and track changes. The YAML files should conform the immortal(8) configuration format.

If a file changes the service will be restarted, immortalctl(8) exit and stop.

If a file is touched and service is down, it will be started, immortalctl(8) start.

If a file is removed, the supervisor will exit, immortalctl(8) exit, this may end the existing process but in cases where the PID is been followed, only the supervisor will exit.

Based on your operating system the directory containing the services could be:

    /usr/local/etc/immortal

or

    /etc/immortal

immortaldir checks for changes also in the IMMORTAL_SDIR directory in order to restart services that are not anymore running, for example when a service has been halted (signal halt) this helps to automatically restart the service.

When dealing with multiple operating systems could be handy to use a unique location like /immortal

To keep services persistent across reboots a startup script should be used to run immortaldir on boot time.
.SH OPTIONS
dir Path of directory containing immortal configuration files "*.yml"

-v print current version
.SH ENVIRONMENT
.TP
.B IMMORTAL_SDIR
This environment variable allows to override the default supervise directory /var/run/immortal, used also by immortalctl(8) and immortal(8)
By default immortaldir after finding a configuration file "service.yml" will invoke immortal(8) and pass to it the option:

    -ctl <service>

This will create the  directory "service" in /var/run/immortal:

    /var/run/immortal/service
                     |--lock
                     `--immortal.sock

    lock is a file that prevents running more than once the same service
    immortal.sock is a Unix socket that can be used to manage the process, example:

    Get status:
        curl --unix-socket immortal.sock http:/status -s

    Down. If the service is running, send it a TERM signal. After it stops, do not restart it:
        curl --unix-socket immortal.sock http://im/signal/down -s

    Start:
        curl --unix-socket immortal.sock http://im/signal/start -s


If a different path instead of /var/run/immortal is required, the IMMORTAL_SDIR environment variable can be used.
.SH EXAMPLES
Read configuration files from /etc/immortal:

    immortaldir /etc/immortal

Read configuration files from /srv/immortal and create supervise directories on /var/www/immortal

    export IMMORTAL_SDIR=/var/www/immortal

    immortaldir /srv/immortal

.SH SEE ALSO
immortal(8), immortalctl(8)
.SH BUGS
https://github.com/immortal/immortal/issues
.SH AUTHOR
.PP
Nicolas Embriz <nbari@tequila.io>
.br
For more information, see the immortal homepage at
.br
https://immortal.run
